<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j" 
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="https://code.google.com/p/rad-framework/taglib" 
	xmlns:tt="https://code.google.com/p/rad-framework"
	xmlns:s="http://jboss.com/products/seam/taglib">

	<c:if test="#{folder.renderTable}">
		<ui:include src="/themes/default/includes/folder-table.xhtml">
			<ui:param name="folder" value="#{folder}" />
			<ui:param name="renderDelete" value="false" />
		</ui:include>
	</c:if>
	<c:if test="#{folder.renderOneToOneView}">
		<ui:include
			src="/#{viewPath == null ? 'jsf' : viewPath}/#{folder.viewPath}#{folder.entityType}/ViewPanel.xhtml">
			<ui:param name="entity" value="#{folder.selected}" />
			<ui:param name="label" value="#{messages['General']}" />
		</ui:include>
	</c:if>


	<c:if test="#{folder.renderQuickAdd or folder.renderOneToOneEdit}">
		<rich:spacer width="10" height="5"/>
		<hr class="rad-framework-horizontal-separator"/>

		<tt:toggle-popup id="#{folder.id}Toggle">
			<ui:define name="closed">
			
				<h:panelGroup style="align:right">
					<rich:toggleControl for="#{folder.id}Toggle"
						styleClass="rad-framework-action-panel">
						<h:outputText styleClass="rad-framework-action-create"
							value="#{messages['Add']} #{folder.entityTypeText}" />
					</rich:toggleControl>
				</h:panelGroup>
			
			</ui:define>
			<ui:define name="open">
			
				<ui:decorate template="/themes/default/includes/quick-add.xhtml">
					<ui:define name="quickbuttons">

						<a4j:commandLink id="saveButton#{folder.id}" type="submit"
							eventsQueue="viewQ" action="#{folder.save}" reRender="#{folder.id}TP"
							styleClass="rad-framework-button-content">
							<s:conversationId />
							<span>
								<h:outputText value="#{messages['Add']}" />
							</span>
						</a4j:commandLink>

						<rich:toggleControl for="#{folder.id}Toggle">
							<h:outputText value="#{messages['Cancel']}" />
						</rich:toggleControl>

					</ui:define>
				</ui:decorate>

			</ui:define>
		</tt:toggle-popup>
	</c:if>
	
	<c:if test="#{folder.renderAdd}">
		<rich:spacer width="10" height="5"/>
		<hr class="rad-framework-horizontal-separator"/>
		<a4j:form id="addLinkForm#{folder.id}">

			<a4j:commandLink styleClass="rad-framework-action-panel"
				rendered="#{folder.renderAdd}"
				action="#{folder.add}">
				<h:outputText styleClass="rad-framework-action-create"
					value="#{messages['Create']} #{folder.entityTypeText}" />
				<s:conversationId/>
			</a4j:commandLink>

		</a4j:form>
	</c:if>

</ui:composition>